chore(test): e2e and scenario for tabs specialEffects scrollToTop#3953
chore(test): e2e and scenario for tabs specialEffects scrollToTop#3953
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an Android-scoped Detox e2e suite to validate specialEffects.repeatedTabSelection.scrollToTop behavior for tabs, and updates the associated Tabs scenario to be e2e-addressable via stable testID / accessibility labels.
Changes:
- Add Detox e2e coverage for
scrollToTop: true,false, and default behavior in the Tabs special-effects scenario. - Add shared e2e utilities (
describeIfAndroid,tapSelectedTab) to support platform-specific tab interactions. - Update the Tabs scenario screen and documentation with e2e-oriented identifiers and naming.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| apps/src/tests/single-feature-tests/tabs/test-tabs-special-effects-scroll-to-top/scenario.md | Updates scenario docs (including e2e coverage statement and screen name). |
| apps/src/tests/single-feature-tests/tabs/test-tabs-special-effects-scroll-to-top/index.tsx | Adds testIDs to scroll views/items and tab bar items to enable deterministic e2e selection. |
| FabricExample/e2e/single-feature-tests/tabs/test-tabs-special-effects-scroll-to-top.e2e.ts | Introduces new Detox suite asserting repeated-tab-selection scroll-to-top behavior. |
| FabricExample/e2e/e2e-utils.ts | Adds Android-only describe helper and a helper to tap tab items in a platform-specific way. |
Comments suppressed due to low confidence (1)
apps/src/tests/single-feature-tests/tabs/test-tabs-special-effects-scroll-to-top/index.tsx:63
- This
scrollToTop: falseblock is missing the trailing comma used elsewhere in this file’s multi-line object literals (e.g. thescrollToTop: true,case just above). Align formatting for consistency (and to avoid formatter churn).
specialEffects: {
repeatedTabSelection: {
scrollToTop: false
},
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| describe('Tabs specialEffects — scrollToTop', () => { | ||
| beforeAll(async () => { | ||
| await device.reloadReactNative(); | ||
| await selectSingleFeatureTestsScreen( | ||
| 'Tabs', | ||
| 'test-tabs-special-effects-scroll-to-top', | ||
| ); |
| ## E2E test | ||
|
|
||
| Other: ongoing research. | ||
| Yes: Covers all manual scenario steps. |
| import { device, expect, element, by } from 'detox'; | ||
| import { AndroidElementAttributes, IosElementAttributes } from 'detox/detox'; |
There was a problem hiding this comment.
I don't think that we can really do anything about it.
There was a problem hiding this comment.
I was already trying to get rid of it and it didn't work so I kept it in this form.
| export async function tapSelectedTab(testLabel: string) { | ||
| if (device.getPlatform() === 'ios') { | ||
| const elementAttributes = await getElementAttributes(testLabel); | ||
| const { x, y, width, height } = elementAttributes.frame; | ||
| await device.tap({ | ||
| x: x + width / 2, | ||
| y: y + height / 2, | ||
| }); | ||
| } else { | ||
| await element(by.label(testLabel)).tap(); | ||
| } |
Co-authored-by: Krzysztof Ligarski <63918941+kligarski@users.noreply.github.com>
…f github.com:software-mansion/react-native-screens into @lkuchno/e2e-test-tabs-special-effects-scroll-to-top
kligarski
left a comment
There was a problem hiding this comment.
Looks good.
The last suggestion I have is to add some comments to new util methods so that we know why we needed them in the future.
…effects-scroll-to-top.e2e.ts Co-authored-by: Krzysztof Ligarski <63918941+kligarski@users.noreply.github.com>
Co-authored-by: Krzysztof Ligarski <63918941+kligarski@users.noreply.github.com>
Description
This PR adds a new Detox e2e test suite that validates the
specialEffects.repeatedTabSelection.scrollToToptab property and update the scenario e2e test section. The Detox e2e tests covers all manual steps.New functions were added to e2e-utils.ts file to enable selecting already open tab on iOS26.2 and another one to allow run test just for android.
Closes: https://github.com/software-mansion/react-native-screens-labs/issues/1190
Changes
Added Detox e2e test suite
test-tabs-special-effects.e2e.tscoveringscrollToTop: true,scrollToTop: false, and default (nospecialEffects) behavior;Added new functions into e2e-utils:
describeIfAndroidandforceTapByLabeliOSUpdate
test-tabs-special-effectsscenario screen with e2e covarage information and index with testID valuesUpdate index with testIDs needed in e2e test